package com.itstherules.jmsunit.loaders;

import org.junit.Assert;
import org.junit.Test;


public class XmlLoaderTest {

	static final String SEPARATOR = System.getProperty("line.separator");

	@Test
	public void canLoadXmlAsString() throws Exception {
		FileLoader unit = new XmlLoader();
		String reply = unit.load("test_xml");
		Assert.assertEquals(
				"<hobbit>" + SEPARATOR +
				"	<name>Bilbo Baggins</name>" + SEPARATOR +
				"	<age>12</age>" + SEPARATOR +
				"	<carries>The One Ring</carries>" + SEPARATOR +
				"</hobbit>", reply);
	}

	@Test(expected=IllegalArgumentException.class)
	public void cannotLoadXml() throws Exception {
		FileLoader unit = new XmlLoader();
		unit.load("invalid_test_xml");
	}
	
}
